<include file="public@header"/>
<style type="text/css">
    .pic-list li {
        margin-bottom: 5px;
    }
</style>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li><a href="{:url('TechAdmin/techrenzheng')}">认证信息展示</a></li>
        <li class="active"><a href="#">重新认证</a></li>
    </ul>
    <form action="{:url('TechAdmin/addrengzheng')}" method="post" class="form-horizontal js-ajax-form margin-top-20">
        <input type="text" value="{$id}" style="display: none" name="id">
        <div class="row">
            <div class="col-md-9">
                <table class="table table-bordered">
                    <tr>
                        <th style="text-align:center">所在单位</th>
                        <td>
                            <input type="text" value="" class="form-control" name="danwei" placeholder="所在单位" >
                        </td>
                    </tr>
                    <tr>
                        <th style="text-align:center">所获荣誉</th>
                        <td>
                           <textarea class="form-control" name="rongyu" style="height: 40px;"
                                     placeholder="所获荣誉">
                            </textarea>
                        </td>
                    </tr>
                    <tr>
                        <th style="text-align:center">毕业院校</th>
                        <td>
                            <input type="text" value="" class="form-control" name="yuanxiao" placeholder="毕业院校" >
                        </td>
                    </tr>
                    <tr>
                        <th style="text-align:center">简介</th>
                        <td>
                           <textarea class="form-control" name="jianjie" style="height: 40px;"
                                     placeholder="简介">
                            </textarea>
                        </td>
                    </tr>
                    <tr>
                        <th style="text-align:center">师从</th>
                        <td>
                           <textarea class="form-control" name="shicong" style="height: 40px;"
                                     placeholder="师从">
                            </textarea>
                        </td>
                    </tr>
                    <tr>
                        <th style="text-align: center">照片(最多上传四张)</th>
                        <td>
                            <ul id="photos2" class="pic-list list-unstyled form-inline"></ul>
                            <a href="javascript:uploadImages2();"
                               class="btn btn-default btn-sm">选择图片</a>
                            <!-- <div>
                                <input type="hidden" name="zhaopian" class="form-control"
                                       id="js-thumbnail-input" required>

                               <div>
                                    <a href="javascript:uploadOneImage('图片上传','#js-thumbnail-input');">
                                        <img src="__TMPL__/public/assets/images/default-thumbnail.png"
                                             id="js-thumbnail-input-preview"
                                             width="135" style="cursor: pointer"/>
                                    </a>
                                    <input type="button" class="btn btn-sm btn-cancel-thumbnail" value="取消图片"><font style="color: red">请把图片大小控制在1M以内！</font>
                                </div>
                            </div>-->
                        </td>
                    </tr>
                    <tr>
                        <th style="text-align: center">资格证书（最多上传四张）(必填375*375)</th>
                        <td>
                            <ul id="photos" class="pic-list list-unstyled form-inline"></ul>
                            <a href="javascript:uploadImages();"
                               class="btn btn-default btn-sm">选择图片</a>
                        </td>
                    </tr>
                </table>
                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <button type="submit" class="btn btn-primary js-ajax-submit">{:lang('ADD')}</button>
                        <a class="btn btn-default" href="{:url('TechAdmin/techrenzheng')}">{:lang('BACK')}</a>
                    </div>
                </div>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript" src="__STATIC__/js/admin.js"></script>

<script>
    //=================上传图片===========================
    function uploadImages(){
        var len = $('#photos li').length;
        if(len>=4){
            alert('最多只能上传4张图片！');
        }else{
            uploadMultiImage('图片上传','#photos','photos-item-tpl');
        }
    }
    function uploadImages2(){
        var len = $('#photos2 li').length;
        if(len>=4){
            alert('最多只能上传4张图片！');
        }else{
            uploadMultiImage('图片上传','#photos2','photos2-item-tpl');
        }
    }

    $(function(){
        $('.btn-cancel-thumbnail').click(function () {
            $('#js-thumbnail-input-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
            $('#js-thumbnail-input').val('');
        });

        $('.btn-cancel-thumbnail2').click(function () {
            $('#js-thumbnail-input-preview2').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
            $('#js-thumbnail-input2').html('');
        });
    });

</script>
<script type="text/html" id="photos-item-tpl">
    <li id="saved-image{id}">
        <input id="photo-{id}" type="hidden" name="imgs[]" value="{filepath}">
        <input class="form-control" id="photo-{id}-name" type="text" name="photo_names[]" value="{name}"
               style="width: 200px;" title="图片名称">
        <img id="photo-{id}-preview" src="{url}" style="height:36px;width: 36px;"
             onclick="imagePreviewDialog(this.src);">
        <a href="javascript:uploadOneImage('图片上传','#photo-{id}');">替换</a>
        <a href="javascript:(function(){$('#saved-image{id}').remove();})();">移除</a>
    </li>
</script>
<script type="text/html" id="photos2-item-tpl">
    <li id="saved2-image{id}">
        <input id="photo2-{id}" type="hidden" name="zhaopian[]" value="{filepath}">
        <input class="form-control" id="photo2-{id}-name" type="text" name="photo2_names[]" value="{name}"
               style="width: 200px;" title="图片名称">
        <img id="photo2-{id}-preview" src="{url}" style="height:36px;width: 36px;"
             onclick="imagePreviewDialog(this.src);">
        <a href="javascript:uploadOneImage('图片上传','#photo2-{id}');">替换</a>
        <a href="javascript:(function(){$('#saved2-image{id}').remove();})();">移除</a>
    </li>
</script>
</body>
</html>